package com.project.bean;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;

import java.time.LocalDate;

@TableName("t_product")
public class ProductBean {
    /**商品id*/
    @TableId(value = "pk_productId",type = IdType.AUTO)
    private int id;
    /**商品名*/
    @TableField("p_name")
    private String name;
    /**商品价格*/
    @TableField("p_price")
    private int price;
    /**商品产地*/
    @TableField("p_createAddress")
    private String createAddress;
    /**商品生产日期*/
    @TableField("p_createDate")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private LocalDate createDate;
    /**商品图片路径*/
    @TableField("p_img")
    private String imgPath;
    /**商品卖出数量*/
    @TableField(exist = false)
    private int sailCount;

    public ProductBean() {
    }

    public ProductBean(String name, int price, String createAddress, String imgPath) {
        this.name = name;
        this.price = price;
        this.createAddress = createAddress;
        this.imgPath = imgPath;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getPrice() {
        return price;
    }

    public void setPrice(int price) {
        this.price = price;
    }

    public String getCreateAddress() {
        return createAddress;
    }

    public void setCreateAddress(String createAddress) {
        this.createAddress = createAddress;
    }

    public LocalDate getCreateDate() {
        return createDate;
    }

    public void setCreateDate(LocalDate createDate) {
        this.createDate = createDate;
    }

    public String getImgPath() {
        return imgPath;
    }

    public void setImgPath(String imgPath) {
        this.imgPath = imgPath;
    }

    public int getSailCount() {
        return sailCount;
    }

    public void setSailCount(int sailCount) {
        this.sailCount = sailCount;
    }

    @Override
    public String toString() {
        return "productBean{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", price=" + price +
                ", createAddress='" + createAddress + '\'' +
                ", createDate=" + createDate +
                ", imgPath='" + imgPath + '\'' +
                ", sailCount=" + sailCount +
                "}\n";
    }
}
